package com.example.controller;

import com.example.pojo.Comment;
import com.example.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ziqiao
 * @Description
 */
@CrossOrigin
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    CommentService commentService;

    //添加评论
    @RequestMapping("/insert")
    @ResponseBody
    public void insertComment(Comment comment){
        commentService.InsertComment(comment);
    }

    //删除评论
    @RequestMapping("/delete")
    @ResponseBody
    public void deleteComment(Integer commentId){
        commentService.deleteComment(commentId);
    }
}
